<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript" src="js/jquery.itextclear.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
    });
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="${ctx}/css/Tree.css"/>
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css"/>
<script type="text/javascript" src="lib/datatables/js/jquery.dataTables.js"></script>

<!-- DATATABLES CSS END -->

<h1 class="page-title">合同人员查看</h1>

<div class="container_12 clearfix leading">

    <div class="tabs side grid_8 leading">
        <p style="display:none">
            筛选：
            <select name="duty" id="contract_duty">
                <option value="">--请选择--</option>
                <s:iterator value="#request.duties" var="duty">
                    <option value="${duty.id}">${duty.dutyName}</option>
                </s:iterator>
            </select>
            <select name="endTime" id="contract_endTime">
                <option value="0">--请选择--</option>
                <option value="1">一个月内</option>
                <option value="2">二个月内</option>
                <option value="3">三个月内</option>
                <option value="4">半年内</option>
                <option value="5">一年内</option>
            </select>
            <input type="button" value="点击搜索"
                   onclick="javascript:searchClickEvent()">
        </p>
        <div class="grid_12">
            <div id="demo" class="clearfix">
                <table class="display" id="example">
                    <thead>
                    <tr>
                        <th>工号</th>
                        <th>姓名</th>
                        <th>部门</th>
                        <th>职务</th>
                        <th>合同类别</th>
                        <th>合同到期时间</th>
                        <th style="width: 80px;">合同状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    <s:if test="#request.viewPojos == null or #request.viewPojos.size() == 0">
                        <tr>
                            <td colspan="7">没有数据</td>
                        </tr>
                    </s:if>
                    <s:iterator value="#request.viewPojos" var="sign" status="sta">
                        <s:if test="#sta.even">
                            <tr class="gradeA">
                        </s:if>
                        <s:else>
                            <tr class="gradeC">
                        </s:else>
                        <td>${sign.workNo}</td>
                        <td>${sign.name}</td>
                        <td>${sign.department}</td>
                        <td>${sign.duty.dutyName}</td>
                        <td>${sign.contractType}</td>
                        <td>${sign.endDate}天</td>
                        <s:if test="#sign.state==9 or #sign.state==10">
                            <td><a class="button" href="#contract/audit_detail.xhtml?signPojo.work.id=${workId}&signPojo.contractSignId=&t=<%=new java.util.Date().getTime()%>"><span
                                    style="background:url(${ctx}/images/img/script_error.png)"
                                    class="icon">&nbsp;</span>${sign.state=='10' ? "已续签" : "续签"}</a>
                            </td>
                        </s:if>
                        <s:else>
                            <td></td>
                        </s:else>

                        </tr>
                    </s:iterator>

                    </tbody>
                </table>
            </div>
        </div>


    </div>
</div>

<div class="clear"></div>
<div class="form-action clearfix">
    <p>
        <%@ include file="/WEB-INF/pages/common/main_pager.jsp" %>
    </p>

</div>

<script type="text/javascript" src="js/Tree.js"></script>
<script type="text/javascript">
    function searchClickEvent() {
        search();
    }
    function search() {
        var url = "${ctx}/contract/contPersonView.xhtml";
        var dutyId = $("#contract_duty").val();
        var month=$("#contract_endTime").val();
        alert(dutyId);
        alert(month);
        var data = {"dutyId":dutyId,"month":month};
        $.ajax(url, {
            type:"POST",
            data:data,
            dataType:"html",
            cache:false,
            success:function (a) {
                var obj = $("#list_content");
                obj.html("");
                obj.append(a);
            },
            complete:function () {
            }
        });
    }
</script>